<?php
	include 'header.php';	
?>
<h2><?php echo $title; ?></h2>

<div id="menu">Thực đơn hôm qua <?php echo $yesterday; ?></div>
<table>
	<?php
		$i = 0;
		$countList = count($menu['yesterday']);
		foreach ($menu['yesterday'] as $id => $foods) 
		{
			// 5 món 1 dòng
			// 10 cột s/p 1 dòng
			if( $i == 0 )
			{
				echo "<tr>";
			}
			else if( $i == 5 )
			{
				echo "</tr><tr>";
				$i = 0;
			}
			else if( $i == $countList )
			{
				echo "</tr>";
			}
			echo '<th><a href="'.site_url('home/menu/'.$foods['food']['id']).'"><img src="'.base_url('uploads/'.$foods['food']['picture']).'" height="150px" width="150px"/></a><br>'.$foods['food']['name'].'<br>Số lượng : '.$foods['number'].' (gr)</th>';
			$i++;
		}
	?>
</table>

<div id="menu">
	Thực đơn hôm nay <?php echo $today; ?>
	&nbsp;
	<a href="<?php echo site_url('home/addFoodToMenu/today'); ?>">[Thêm món ăn hôm nay]</a>
</div>
<table>
	<?php
		$i = 0;
		$countList = count($menu['today']);
		foreach ($menu['today'] as $id => $foods) 
		{			
			// 5 món 1 dòng
			// 10 cột s/p 1 dòng
			if( $i == 0 )
			{
				echo "<tr>";
			}
			else if( $i == 5 )
			{
				echo "</tr><tr>";
				$i = 0;
			}
			else if( $i == $countList )
			{
				echo "</tr>";
			}
			echo '<th><a href="'.site_url('home/menu/'.$foods['food']['id']).'"><img src="'.base_url('uploads/'.$foods['food']['picture']).'" height="150px" width="150px"/><br></a>'.$foods['food']['name'].'<a href="'.site_url('home/deleteFoodInMenu/'.$id).'" onClick="return deleteFoodInMenu()">[x]</a><br>Số lượng : '.$foods['number'].' (gr)</th>';
			$i++;
		}
	?>
</table>

<div id="menu">
	Thực đơn ngày mai <?php echo $tomorrow; ?>
	&nbsp;
	<a href="<?php echo site_url('home/addFoodToMenu/tomorrow'); ?>">[Thêm món ăn ngày mai]</a>
</div>
<table>
	<?php
		$i = 0;
		$countList = count($menu['tomorrow']);
		foreach ($menu['tomorrow'] as $id => $foods) 
		{
			// 5 món 1 dòng
			// 10 cột s/p 1 dòng
			if( $i == 0 )
			{
				echo "<tr>";
			}
			else if( $i == 5 )
			{
				echo "</tr><tr>";
				$i = 0;
			}
			else if( $i == $countList )
			{
				echo "</tr>";
			}
			echo '<th><a href="'.site_url('home/menu/'.$foods['food']['id']).'"><img src="'.base_url('uploads/'.$foods['food']['picture']).'" height="150px" width="150px"/></a><br>'.$foods['food']['name'].'<a href="'.site_url('home/deleteFoodInMenu/'.$id).'" onClick="return deleteFoodInMenu()">[x]</a><br>Số lượng : '.$foods['number'].' (gr)</th>';
			$i++;
		}
	?>
</table>